name = sinks
dist = dist
ver = 0.5
files = source/sink.py \
		source/run.py \
		source/config/default
build = build

sinks = $(dist)/$(ver)/$(name)-$(ver).zip $(dist)/$(ver)/$(name)-$(ver).tar \
		$(dist)/$(ver)/$(name)-$(ver).rar $(dist)/$(ver)/$(name)-$(ver).7z \
		$(dist)/$(ver)/$(name)-$(ver).tar.gz $(dist)/$(ver)/$(name)-$(ver).tar.bz2
license = gpl
email = mjbauer95@gmail.com


all: build

build: $(dist)/$(ver) prepare $(sinks) terminate

prepare: $(files)
	@mkdir -p $(name)-$(ver)
	@mkdir -p $(name)-$(ver)/sinks
	@mkdir -p $(name)-$(ver)/config	
	@cp -r source/sinks/svn.py source/sinks/pc.py source/sinks/gdocs.py \
			source/sinks/__init__.py $(name)-$(ver)/sinks
	@cp -r source/run.py source/sink.py $(name)-$(ver)
	@cp -r source/config/default $(name)-$(ver)/config

terminate: $(name)-$(ver)
	@rm -r $(name)-$(ver)

$(dist):
	@mkdir $(dist)

$(dist)/$(ver): $(dist)
	@mkdir $(dist)/$(ver)
	
%.7z: $(name)-$(ver)
	@7z a -r $@ $<
	
%.zip: $(name)-$(ver)
	@zip -r $@ $<

%.rar: $(name)-$(ver)
	@rar a -r $@ $<

%.deb: $(name)-$(ver).tar.bz2
	dh_make -c $(license) -e $(email) -f $< -s

%.tar: $(name)-$(ver)
	@tar -cvvf $@ $<

%.tar.gz: $(name)-$(ver)
	@tar czvf $@ $<

%.tar.bz2: $(name)-$(ver)
	@tar czvf $@ $<

%.exe:
	@python setup.py py2exe

clean: $(dist)/$(ver)
	@rm -r $(dist)/$(ver)